export class ComponentFactory {
  static components = {};
  registerComponent(type, component) {
    ComponentFactory.components[type] = component;
  }
  unregisterComponent(type) {
    ComponentFactory.components[type] = null;
  }
  getComponent(ctx, data) {
    const {type = 'text'} = data;
    const genComp = ComponentFactory.components[type];
    if (genComp) {
      return genComp(ctx, data);
    }
  }
}
export default new ComponentFactory();
